<%@page import="systems.AdsSystem"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%@page import="helpers.DateHelper"%>
<%@page import="helpers.HeaderHelper"%>
<%@page import="helpers.CountryHelper"%>
<%@page import="java.util.List"%>
<%@page import="models.Outlink"%>
<%@page import="models.Inlink"%>
<%@page import="models.GoogleAnalytic"%>
<%@page import="models.GoogleAdsense"%>
<%@page import="models.IpTrack"%>
<%@page import="helpers.StringHelper"%>
<%@page import="models.Domain"%>
<%
	HeaderHelper headerHelper = (HeaderHelper) request.getAttribute("headerHelper");
	Domain domain = (Domain) request.getAttribute("domain");
	IpTrack ipTrack = (IpTrack) request.getAttribute("ipTrack");
	GoogleAdsense ads = (GoogleAdsense) request.getAttribute("ads");
	GoogleAnalytic googleAnalytic = (GoogleAnalytic) request.getAttribute("googleAnalytic");
	Inlink inlink = (Inlink) request.getAttribute("inlink");
	Outlink outlink = (Outlink) request.getAttribute("outlink");
	List<Long> d = DateHelper.coundownFromNow(domain.getUpdated());
	List<Long> l = DateHelper.calDistanceTimeToNow(domain.getUpdated());
	String domainOther = "http://www.domainworlds.net";
%>

<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=headerHelper.getTitle()%>" />
    <jsp:param name="description" value="<%=headerHelper.getDescription()%>" />
    <jsp:param name="keywords" value="<%=headerHelper.getKeywords()%>" />
    <jsp:param name="ogite_name" value="<%=headerHelper.getOgite_name()%>" />
    <jsp:param name="ogtitle" value="<%=headerHelper.getOgtitle()%>" />
    <jsp:param name="ogurl" value="<%=headerHelper.getOgurl()%>" />
    <jsp:param name="ogimage" value="<%=headerHelper.getOgimage()%>" />
    <jsp:param name="ogescription" value="<%=headerHelper.getOgescription()%>" />
</jsp:include>
<script type="text/javascript">
<!--
	var update = <%=(d.get(0) <= 0 || d.get(1) <= 0 || d.get(2) <= 0) ? "true" : "false" %>;
	var domain = "<%=domain.getName()%>";
//-->
</script>
		<!-- 2. content -->
		<div id="content">
			<!-- 3. site-header -->
			<div class="site-header">
				<table width="100%">
					<tr>
						<td width="80%">
							<div class="info">
								<%
								Boolean update = (d.get(0) <= 0 || d.get(1) <= 0 || d.get(2) <= 0) ? true : false;
								%>
								<h2><a style="font-size: 32px" href="/o/<%=domain.getName() %>"><%=domain.getName() %></a>
									<% if (update) { %> 
									<a id="update" href="javascript:void(0)">(Update)</a>
									<% } %>
								</h2>
								<% if (!update) { %>
								<span>(Next update: 
									<strong><%=d.get(0) > 0 ? Long.toString(d.get(0)) : "0" %></strong> days, 
									<strong><%=d.get(1) > 0 ? Long.toString(d.get(1)) : "0" %></strong> hours, 
									<strong><%=d.get(2) > 0 ? Long.toString(d.get(2)) : "0"%></strong> minutes
								)</span>
								<% } else { %>
								<span>(Last updated: 
									<strong><%=l.get(0) > 0 ? Long.toString(l.get(0)) : "0" %></strong> days, 
									<strong><%=l.get(1) > 0 ? Long.toString(l.get(1)) : "0" %></strong> hours, 
									<strong><%=l.get(2) > 0 ? Long.toString(l.get(2)) : "0"%></strong> minutes
								)</span>
								<% } %>
								<div class="clear"></div>
							</div>
							<div class="adv">
								<%=AdsSystem.getAds468x15() %>
								<br />
							</div>
							<%=domain.getDescription() %>
						</td>
						<td align="center">
							<img src="http://chart.apis.google.com/chart?chs=75x75&cht=qr&chld=|0&chl=<%=domain.getName() %>" />
							<div>#<%=domain.getGooglePageRank() %> Google Rank</div>
							<div>#<%=domain.getAlexaGlobeRank() %> Alexa Rank</div>
						</td>
					</tr>
				</table>
			</div>
			<!-- 3. end site-header -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<!-- google adsense -->
				<%=AdsSystem.getAds728x90() %>
				<!-- end google adsense -->
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info clear">
				<h3>Site Info</h3>
				<div class="adv menu-right">
					<%=AdsSystem.getAds468x15() %>
					<br />
				</div>
				<div class="clear">
					<div class="adv right">
						<%=AdsSystem.getAds200x200() %>
					</div>
					<table>
						<tr>
							<td width="30%">Domain:</td>
							<td><%=domain.getName() %></td>
						</tr>
						<tr>
							<td>Title:</td>
							<td><%=domain.getTitle() == null || domain.getTitle().isEmpty() ? "_" : domain.getTitle() %></td>
						</tr>
						<tr>
							<td>Keywords:</td>
							<td><%=domain.getKeywords() == null || domain.getKeywords().isEmpty() ? "_" : domain.getKeywords() %></td>
						</tr>
						<tr>
							<td>Popular Keyword:</td>
							<td><%=domain.getPopularKeywords() == null || domain.getPopularKeywords().isEmpty() ? "_" : domain.getPopularKeywords() %></td>
						</tr>
						<tr>
							<td>Description:</td>
							<td><%=domain.getDescription() == null || domain.getDescription().isEmpty() ? "_" : domain.getDescription() %></td>
						</tr>
						<tr>
							<td>Estimate Visitor per Day:</td>
							<td><%=domain.getVisitorPerDay() %></td>
						</tr>
						<tr>
							<td>Site category :</td>
							<td><%=domain.getCategory() == null || domain.getCategory().size() == 0 ? "_" : StringHelper.listToString(domain.getCategory(), ", ")%></td>
						</tr>
						<tr>
							<td>Domain Age:</td>
							<td><%=domain.getAge()%></td>
						</tr>
					</table>
				</div>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Site Technical Info</h3>
				<table width="100%">
					<tr>
						<td width="30%">Page Speed:</td>
						<td><div id="page_speed"><a onclick="runPagespeed()" href="javascript:void(0)" class="info-link">Check now</a></div></td>
					</tr>
					<tr>
						<td>Programming Language:</td>
						<td><%=domain.getProgrammingLanguage() == null ? "_" : domain.getProgrammingLanguage()%></td>
					</tr>
					<tr>
						<td>Web server:</td>
						<td><%=domain.getWebServer() == null ||domain.getWebServer().isEmpty() ? "_" : domain.getWebServer() %></td>
					</tr>
					<tr>
						<td>Javascript library:</td>
						<td><%=domain.getJavascriptLibrary() != null || domain.getJavascriptLibrary().size() > 0 ? StringHelper.listToString(domain.getJavascriptLibrary(), ", ") : "_" %></td>
					</tr>
					<tr>
						<td>IP Address:</td>
						<td><a href="/ip/<%=domain.getIpAddress() %>"><%=domain.getIpAddress() %></a></td>
					</tr>
					<tr>
						<td valign="top">Who is:</td>
						<td>
							<div class="whois-detail"><%=domain.getWhois()%></div>
							<a href="/w/<%=domain.getName() %>" class="more-detail info-link">More details...</a>
						</td>
					</tr>
				</table>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">	
				<h3>Site Contact Info</h3>
				<table width="100%">
					<% if (!domain.getEmail().isEmpty()) { %>
					<tr>
						<td width="30%">Email:</td>
						<td><%=domain.getEmail() %></td>
					</tr>
					<% } %>
					<tr>
						<td>Site's same Google Analytic (<%=domain.getGoogleAnalytic() %>):</td>
						<td>
							<% 
								List<String> googleAnalyticDomains = googleAnalytic.getDomain();
								for (int i = 0; i < googleAnalyticDomains.size(); i++) {
							%>
								<% if (i > 0) { %> , <% } %>
								<a href="<%=UrlHelper.checkDomain(googleAnalyticDomains.get(i)) ? "" : domainOther %>/s/<%=googleAnalyticDomains.get(i)%>"><%=googleAnalyticDomains.get(i)%></a>
							<% } %>
						</td>
					</tr>
					<tr>
						<td>Site's same Google Adsense  (<%=domain.getGoogleAdsense() %>):</td>
						<td>
							<% 
								List<String> adsDomains = ads.getDomain();
								for (int i = 0; i < adsDomains.size(); i++) {
							%>
								<% if (i > 0) { %> , <% } %>
								<a href="<%=UrlHelper.checkDomain(adsDomains.get(i)) ? "" : domainOther %>/s/<%=adsDomains.get(i)%>"><%=adsDomains.get(i)%></a>
							<% } %>
						</td>
					</tr>
				</table>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Links</h3>
				<table width="100%">
					<tr>
						<td width="30%">Outbound links:</td>
						<td>
							<%
								List<String> outlinks = (List<String>) outlink.getDomains();
								for (int i = 0; i < outlinks.size(); i++) {
							%>
									<% if (i > 0) { %> , <% } %>
								<a rel="nofollow" href="<%=UrlHelper.checkDomain(outlinks.get(i)) ? "" : domainOther %>/s/<%=outlinks.get(i)%>"><%=outlinks.get(i)%></a>
							<% } %>
						</td>
					</tr>
					<tr>
						<td>Inbound links:</td>
						<td>
							<%
								List<String> inlinks = (List<String>) inlink.getDomains();
								for (int i = 0; i < inlinks.size(); i++) {
							%>
									<% if (i > 0) { %> , <% } %>
								<a href="<%=UrlHelper.checkDomain(inlinks.get(i)) ? "" : domainOther %>/s/<%=inlinks.get(i)%>"><%=inlinks.get(i)%></a>
							<% } %>
						</td>
					</tr>
				</table>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Domain Traffic Graph</h3>
				<table width="100%">
					<tr>
						<td width="50%">
							<h4>Daily Rank</h4>
							<img src="http://traffic.alexa.com/graph?c=1&u=<%=domain.getName()%>&r=6m&y=t&z=3&h=200&w=280&b=FFFFFF" />
						</td>
						<td>
							<h4>Daily Page Views</h4>
							<img src="http://traffic.alexa.com/graph?c=1&u=<%=domain.getName()%>&r=6m&y=r&z=3&h=200&w=280&b=FFFFFF" />
						</td>
					</tr>
			
				</table>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Visitors by Country for: <a href="/s/<%=domain.getName()%>"><%=domain.getName()%></a></h3>
				<table width="100%">
					<tr>
						<td width="50%" valign="top">
							<table width="100%" class="country-visitor">
								<thead>
									<tr>
										<td width="60%">Country</td>
										<td>Percent of Visitor</td>
									</tr>
								</thead>
								<tbody>
									<%
										List<String> visitorCountryName = domain.getVisitorCountryName();
										List<String> visitorCountryPercent = domain.getVisitorCountryPercent();
										if (visitorCountryName.size() > 0) {
											for (int i = 0; i < visitorCountryName.size(); i++ ) {
									%>
									<tr>
										<td><img src="/images/flags/<%=CountryHelper.getCountryByName(visitorCountryName.get(i)).getIosCode2Digit().toLowerCase()%>.png" width="16" height="11" /> <%=visitorCountryName.get(i)%></td>
										<td align="center"><%=visitorCountryPercent.get(i)%>%</td>
									</tr>
									<%
											}
										}
									%>
								</tbody>
							</table>
							<a href="javascript:void(0)" class="view-all info-link">View all</a>
						</td>
						<td>
			                <object width="400px" height="225px" type="application/x-shockwave-flash" wmode="transparent" 
			                	settings_file="http://www.alexa.com/amMap/ammap_settings.xml" 
			                	data_file="http://www.alexa.com/amMap/index.php?settings=csstips.org;country_traffic" 
			                	path="http://www.alexa.com/amMap/ammap/" bgcolor="#E9F0FF" class="feedback-subject" name="ammap_c8de625c0bde43c1c5036fb36091bc6b" 
			                	data="http://www.alexa.com/amMap/ammap.swf" id="ammap_c8de625c0bde43c1c5036fb36091bc6b" style="visibility: visible;">
								<param name="wmode" value="transparent">
								<param name="settings_file" value="http://www.alexa.com/amMap/ammap_settings.xml">
								<param name="data_file" value="http://www.alexa.com/amMap/index.php?settings=<%=domain.getName()%>;country_traffic">
								<param name="path" value="http://www.alexa.com/amMap/ammap/">
								<param name="flashvars" value="wmode=transparent&amp;settings_file=http://www.alexa.com/amMap/ammap_settings.xml&amp;data_file=http://www.alexa.com/amMap/index.php?settings=<%=domain.getName()%>;country_traffic&amp;path=http://www.alexa.com/amMap/ammap/">
							</object>
						</td>
					</tr>
				</table>
			</div>
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<%
			if (domain.getAnalysisVisitorsCompete() > 0) {
			%>
			<div class="site-info">
				<h3>Compete Graphic : <%=domain.getAnalysisVisitorsCompete() %></a></h3>
				<div>
					<embed width="575" height="275" flashvars="settings_file=http://siteanalytics.compete.com%2Fasync%2Fchart%2F<%=domain.getName()%>%2Fuv%2F%3Fsource_panel%3Dus" wmode="opaque" quality="high" bgcolor="#ffffff" name="chart_3_obj" id="chart_3_obj" style="undefined" src="http://siteanalytics.compete.com/site_media/flash/charts/amline.swf" type="application/x-shockwave-flash">
				</div>
			</div>
			<% } %>
			<!-- 3. end site-info -->
			
			
			<!-- 3. site-info -->
			<!-- 
			<div class="site-info">
				<h3>Quantcast Graphic</a></h3>
				<div>
					<iframe marginwidth="0px" marginheight="0px" scrolling="no" frameborder="0" height="305" width="722"  
						src="http://www.quantcast.com/profile/embed?img=/profile/trafficGraph%3Fwunit%3Dwd%253Acom.youtube%26mobile%3Dfalse%26drg%3DUS%26dty%3Dpp%26gl%3D6mo%26reachType%3Dperiod%26dtr%3Ddm%26width%3D722%26country%3DUK%26ggt%3Dlarge%26showDeleteButtons%3Dtrue&w=722&h=305&showDeleteButtons=false&wunit=Charts.Traffic.FrequencyGraph.">
					</iframe>
				</div>
			</div>
			 -->
			<!-- 3. end site-info -->
			
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Other sites hosted on : <a href="/ip/<%=domain.getIpAddress() %>"><%=domain.getIpAddress() %></a></h3>
				<div>
					<%=StringHelper.listToString(ipTrack.getDomain(), ", ") %>
				</div>
			</div>
			<!-- 3. end site-info -->
			
			<%
			if (UrlHelper.checkDomain(domain.getName()) && !UrlHelper.checkIsSubDomain(domain.getName())) {
			%>
			<!-- 3. site-info -->
			<div class="site-info">
				<h3>Link</h3>
				<div>
					<p> - View infomation domain <a target="_blank" class="info-link" href="http://www.showsiteinfo.net/sites/<%=domain.getName()%>"><%=domain.getName()%></a> in showsiteinfo.net</p>
				</div>
			</div>
			<!-- 3. end site-info -->
			<% } %>
		</div>
		<!-- 2. end content -->
		
		<!-- 2. side -->
		<div id="side">
			<!-- 3. block -->
			<div class="block">
				<%=AdsSystem.getAds300x250() %>
			</div>
			<!-- 3. end block -->
			
			<!-- 3. block -->
			<div class="block">
				<h3>Near Sites</h3>
				<div class="lst">
					<ul>
						<%
							List<String> nearSites = domain.getNearSites();
							for (int i = 0; i < nearSites.size(); i++) {
								if (UrlHelper.checkDomain(nearSites.get(i))) {
						%>
							<li><a href="/s/<%=nearSites.get(i)%>"><%=nearSites.get(i)%></a></li>
						<%  	}
							} %>
						</ul>
					</ul>
				</div>
			</div>
			<!-- 3. end block -->
			
			<!-- 3. block -->
			<div class="block">
				<h3>Random Sites</h3>
				<div class="lst">
					<ul>
					<%
						List<String> randomSites = domain.getRandomSites();
						for (int i = 0; i < randomSites.size(); i++) {
							if (UrlHelper.checkDomain(randomSites.get(i))) {
					%>
						<li><a href="/s/<%=randomSites.get(i)%>"><%=randomSites.get(i)%></a></li>
					<%  	}
						} %>
					</ul>
				</div>
			</div>
			<!-- 3. end block -->
		</div>
		<!-- 2. end side -->
		
		<div class="clear"></div>

<script type="text/javascript" src="/js/info.js"></script>
<script type="text/javascript">
<!--
	var url_update = "<%=UrlHelper.getServerUrl(request)%>/u/<%=domain.getName()%>?allow=true";
//-->
</script>
<div id='opacity'></div>
<img src="/images/ajax-loader.gif" id='image_loadder' />

<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>